/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.ofbiz.eclipse.model.webapp.SiteConf.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.ofbiz.eclipse.model.webapp.SiteConf.EventType;
import org.ofbiz.eclipse.model.webapp.SiteConf.GlobalTransactionType;
import org.ofbiz.eclipse.model.webapp.SiteConf.SiteConfPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Event Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.EventTypeImpl#getGlobalTransaction <em>Global Transaction</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.EventTypeImpl#getInvoke <em>Invoke</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.EventTypeImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.EventTypeImpl#getPath <em>Path</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.EventTypeImpl#getType <em>Type</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EventTypeImpl extends EObjectImpl implements EventType {
	/**
	 * The default value of the '{@link #getGlobalTransaction() <em>Global Transaction</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGlobalTransaction()
	 * @generated
	 * @ordered
	 */
	protected static final GlobalTransactionType GLOBAL_TRANSACTION_EDEFAULT = GlobalTransactionType.TRUE;

	/**
	 * The cached value of the '{@link #getGlobalTransaction() <em>Global Transaction</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGlobalTransaction()
	 * @generated
	 * @ordered
	 */
	protected GlobalTransactionType globalTransaction = GLOBAL_TRANSACTION_EDEFAULT;

	/**
	 * This is true if the Global Transaction attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean globalTransactionESet;

	/**
	 * The default value of the '{@link #getInvoke() <em>Invoke</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInvoke()
	 * @generated
	 * @ordered
	 */
	protected static final String INVOKE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getInvoke() <em>Invoke</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInvoke()
	 * @generated
	 * @ordered
	 */
	protected String invoke = INVOKE_EDEFAULT;

	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getPath() <em>Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPath()
	 * @generated
	 * @ordered
	 */
	protected static final String PATH_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getPath() <em>Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPath()
	 * @generated
	 * @ordered
	 */
	protected String path = PATH_EDEFAULT;

	/**
	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected static final String TYPE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected String type = TYPE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EventTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return SiteConfPackage.Literals.EVENT_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GlobalTransactionType getGlobalTransaction() {
		return globalTransaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setGlobalTransaction(GlobalTransactionType newGlobalTransaction) {
		GlobalTransactionType oldGlobalTransaction = globalTransaction;
		globalTransaction = newGlobalTransaction == null ? GLOBAL_TRANSACTION_EDEFAULT : newGlobalTransaction;
		boolean oldGlobalTransactionESet = globalTransactionESet;
		globalTransactionESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.EVENT_TYPE__GLOBAL_TRANSACTION, oldGlobalTransaction, globalTransaction, !oldGlobalTransactionESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetGlobalTransaction() {
		GlobalTransactionType oldGlobalTransaction = globalTransaction;
		boolean oldGlobalTransactionESet = globalTransactionESet;
		globalTransaction = GLOBAL_TRANSACTION_EDEFAULT;
		globalTransactionESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.EVENT_TYPE__GLOBAL_TRANSACTION, oldGlobalTransaction, GLOBAL_TRANSACTION_EDEFAULT, oldGlobalTransactionESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetGlobalTransaction() {
		return globalTransactionESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getInvoke() {
		return invoke;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInvoke(String newInvoke) {
		String oldInvoke = invoke;
		invoke = newInvoke;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.EVENT_TYPE__INVOKE, oldInvoke, invoke));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.EVENT_TYPE__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getPath() {
		return path;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPath(String newPath) {
		String oldPath = path;
		path = newPath;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.EVENT_TYPE__PATH, oldPath, path));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getType() {
		return type;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setType(String newType) {
		String oldType = type;
		type = newType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.EVENT_TYPE__TYPE, oldType, type));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case SiteConfPackage.EVENT_TYPE__GLOBAL_TRANSACTION:
				return getGlobalTransaction();
			case SiteConfPackage.EVENT_TYPE__INVOKE:
				return getInvoke();
			case SiteConfPackage.EVENT_TYPE__NAME:
				return getName();
			case SiteConfPackage.EVENT_TYPE__PATH:
				return getPath();
			case SiteConfPackage.EVENT_TYPE__TYPE:
				return getType();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case SiteConfPackage.EVENT_TYPE__GLOBAL_TRANSACTION:
				setGlobalTransaction((GlobalTransactionType)newValue);
				return;
			case SiteConfPackage.EVENT_TYPE__INVOKE:
				setInvoke((String)newValue);
				return;
			case SiteConfPackage.EVENT_TYPE__NAME:
				setName((String)newValue);
				return;
			case SiteConfPackage.EVENT_TYPE__PATH:
				setPath((String)newValue);
				return;
			case SiteConfPackage.EVENT_TYPE__TYPE:
				setType((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case SiteConfPackage.EVENT_TYPE__GLOBAL_TRANSACTION:
				unsetGlobalTransaction();
				return;
			case SiteConfPackage.EVENT_TYPE__INVOKE:
				setInvoke(INVOKE_EDEFAULT);
				return;
			case SiteConfPackage.EVENT_TYPE__NAME:
				setName(NAME_EDEFAULT);
				return;
			case SiteConfPackage.EVENT_TYPE__PATH:
				setPath(PATH_EDEFAULT);
				return;
			case SiteConfPackage.EVENT_TYPE__TYPE:
				setType(TYPE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case SiteConfPackage.EVENT_TYPE__GLOBAL_TRANSACTION:
				return isSetGlobalTransaction();
			case SiteConfPackage.EVENT_TYPE__INVOKE:
				return INVOKE_EDEFAULT == null ? invoke != null : !INVOKE_EDEFAULT.equals(invoke);
			case SiteConfPackage.EVENT_TYPE__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case SiteConfPackage.EVENT_TYPE__PATH:
				return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path);
			case SiteConfPackage.EVENT_TYPE__TYPE:
				return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (globalTransaction: ");
		if (globalTransactionESet) result.append(globalTransaction); else result.append("<unset>");
		result.append(", invoke: ");
		result.append(invoke);
		result.append(", name: ");
		result.append(name);
		result.append(", path: ");
		result.append(path);
		result.append(", type: ");
		result.append(type);
		result.append(')');
		return result.toString();
	}

} //EventTypeImpl
